
    import * as React from 'react';
    import * as ReactDOM from 'react-dom';
    import * as Reflux from 'reflux';
    var $ = require("jquery");

    //var $ = require("../../bower_components/jquery-2.1.4.min/index.js");


    var main = function () {
        var SelectActions = Reflux.createActions([
            'get', 'post'
        ]);

        var SelectStore = Reflux.createStore({
            items: {},
            listenables: [SelectActions],
            onGet: function (url, model, param) {

                $.get(url, model, function (data) {

                    data = JSON.parse(data);
                    //console.log("get 数据")

                    //console.log(data)
                    if (data.resultCode == "0") {
                        this.items = data;
                        this.trigger(this.items);
                    } else {
                        this.items = data;
                        this.trigger(this.items);
                    }
                    //console.log(data);
                    return false;

                }.bind(this));
            },
            onPost: function (url, model, param) {

                $.post(url, model, function (data) {

                    data = JSON.parse(data);
                    if (data.resultCode == "0") {
                        this.items = data;
                        this.trigger(this.items);
                    } else {
                        this.items = data;
                        this.trigger(this.items);
                    }
                    //console.log(data);
                    return false;

                }.bind(this));
            }
        });
        return {
            SelectStore: SelectStore,
            SelectActions: SelectActions
        }
    }

    var init = function () {
        var temp = new main();
        return {
            SelectStore: temp.SelectStore,
            SelectActions: temp.SelectActions
        }
    }

    module.exports =  {
        init: init
    };
